﻿using System;
using jSLCore.Client.Presentation.BaseControl;
using jSLCore.Client.Presentation.BaseControl.DialogMessage;

namespace jSLApp.Client.Forms
{
    public partial class SendMail : DialogControl
    {
        public SendMail()
        {
            InitializeComponent();
        }

        #region dialog

        public override void OkClicked()
        {
            var dlg = new QuestionBox("Отправить сообщение?", QuestionBoxType.YesNo);
            dlg.ShowDialog(delegate(object sender, object data)
            {
                DoWork("Отправка сообщения", (o, args) => Communication.Proxy.SendFeedback(args.String), (sender1, eventArgs) =>
                {
                    if (eventArgs.Error == null)
                    {
                        InvokeDataSelected();
                        InfoBox.ShowDialog("Сообщение отправлено");
                    }
                }, txt.Text);
            });
        }
        
        public override bool IsOkVisible
        {
            get { return true; }
        }

        public override bool IsStandartOkCancelEnabled
        {
            get { return true; }
        }

        public override object OkContent
        {
            get { return "Отправить"; }
        }
        
        public override bool AutoSize
        {
            get { return true; }
        }

        public override void LoadInitialData()
        {
            
        }

        #endregion
    }
}
